# VERSIONU=1_2_7
# VERSIOND=1.2.7
-# If you do not have libexpat and you have no use for reading any input
-# type that is XML-ish (i.e. gpx or geocaching.com's/loc) you can uncomment
-# INHIBIT_EXPAT and coment out LIBEXPAT on just to get a build working quickly.
-# INHIBIT_EXPAT=-DNO_EXPAT
-LIBEXPAT=@EXPAT_LIB@ # -lefence
+#EXTRA_LIBS -lefence
# Space is significant, because MSVC wants no space between switch and arg (-Fofoo.o)
# but cc/gcc does:
DEBUGGING=-g $(EXTRA_DEBUGGING)
# add -DDEBUG_MEM to turn on memory allocation logging
GBCFLAGS=$(EXTRA_CFLAGS) $(DEBUGGING) -I. -I@srcdir@/coldsync \
- $(INHIBIT_USB) $(OPTIMIZATION) @CFLAGS@
+ $(OPTIMIZATION) @CFLAGS@
INSTALL_TARGETDIR=/usr/local/
# OTHER_ROOT=/opt/local # For DarwinPorts on OSX
LIBOBJS = queue.o route.o waypt.o filter_vecs.o util.o vecs.o mkshort.o \
csv_util.o strptime.o grtcirc.o vmem.o util_crc.o xmlgeneric.o \
uuid.o formspec.o xmltag.o cet.o cet_util.o fatal.o rgbcolors.o \
- inifile.o garmin_fs.o gbsleep.o \
+ inifile.o garmin_fs.o gbsleep.o units.o @GBSER@ \
$(COLDSYNC) $(GARMIN) $(JEEPS) $(SHAPE) $(FMTS) $(FILTERS)
OBJS = main.o globals.o $(LIBOBJS)
all: gpsbabel@EXEEXT@
gpsbabel@EXEEXT@: $(OBJS)
- @CC@ $(CFLAGS) $(OBJS) @LIBS@ @USB_LIBS@ $(LIBEXPAT) $(OUTPUT_SWITCH)$@
+ @CC@ $(CFLAGS) $(OBJS) @LIBS@ @EXPAT_LIB@ @USB_LIBS@ $(OUTPUT_SWITCH)$@
Makefile: Makefile.in config.status
CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
double distance_meters;
double max_alt;
double min_alt;
- double max_spd;
- double min_spd;
+ double max_spd; /* Meters/sec */
+ double min_spd; /* Meters/sec */
time_t start; /* Min time */
time_t end; /* Max time */
} computed_trkdata;
ff_cap_read = 1,
ff_cap_write = 2
} ff_cap;
+
#define FF_CAP_RW_ALL \
{ ff_cap_read | ff_cap_write, ff_cap_read | ff_cap_write, ff_cap_read | ff_cap_write }
unsigned long get_crc32(const void * data, int datalen);
unsigned long get_crc32_s(const void * data);
+/*
+ * From units.c
+ */
+typedef enum {
+ units_unknown = 0,
+ units_statue = 1,
+ units_metric =2
+} fmt_units;
+
+int fmt_setunits(fmt_units);
+double fmt_distance(const double, char **tag);
+double fmt_speed(const double, char **tag);
+
/*
* From gbsleep.c
*/
first.latitude = 0;
first.longitude = 0;
first.creation_time = 0;
- tdata->min_alt = 999999;
-
+ tdata->min_alt = 999999999;
+ tdata->max_alt = -999999999;
QUEUE_FOR_EACH((queue *)&trk->waypoint_list, elem, tmp) {
time_t timed;
dist = radtometers(gcdist(plat, plon, tlat, tlon));
/*
- * Avoid that 6300 miles as we move from 0,0.
+ * Avoid that 6300 mile jump as we move from 0,0.
*/
if (plat && plon) {
tdata->distance_meters += dist;
}
/*
- * If we've moved, recompute speed.
+ * If we've moved as much as a meter, recompute speed.
*/
- if (timed) {
+ if (timed && (dist > 1)) {
this->speed = dist / labs(timed);
if (this->speed > tdata->max_spd) {
tdata->max_spd = this->speed;
--- /dev/null
+/*
+ Display scaled distances in 'local' units.
+
+ Copyright (C) 2006 Robert Lipe, robertlipe@usa.net
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+ */
+
+#include "defs.h"
+
+static int units = units_statue;
+
+int
+fmt_setunits(fmt_units u)
+{
+ switch (u) {
+ case units_statue:
+ case units_metric:
+ units = u;
+ return 0;
+ default:
+ return 1;
+ }
+}
+
+double
+fmt_distance(const double distance_meters, char **tag)
+{
+ double d;
+
+ switch (units) {
+ case units_statue:
+ d = METERS_TO_FEET(distance_meters);
+ if (d < 5280) {
+ *tag = "ft";
+ } else {
+ d = METERS_TO_MILES(distance_meters);
+ *tag = "mi";
+ }
+ break;
+ case units_metric:
+ d = distance_meters;
+ if (d < 1000) {
+ *tag = "meters";
+ } else {
+ d = d / (double) 1000.0;
+ *tag = "km";
+ }
+ break;
+
+ default:
+ fatal("not done yet");
+ break;
+ }
+
+ return d;
+}
+
+double
+fmt_speed(const double distance_meters_sec, char **tag)
+{
+ double d;
+
+ switch (units) {
+ case units_statue:
+ d = METERS_TO_MILES(distance_meters_sec) * SECONDS_PER_HOUR ;
+ *tag = "mph";
+ break;
+ case units_metric:
+ d = distance_meters_sec * SECONDS_PER_HOUR;
+ *tag = "meters/hour";
+ if (d > 1000.0) {
+ d /= 1000.0;
+ *tag = "km/hour";
+ }
+ break;
+ default: fatal("not done yet");
+
+ }
+ return d;
+}